<!doctype html>
<html lang="en">

	<head>

		<!-- Basic Page Needs
    ================================================== -->
		<title>TubeLite Streaming Video HTML Template</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="TubeLite is - Professional A unique and beautiful collection of UI elements">
		<link rel="icon" href="assets/images/favicon.png">

		<!-- CSS 
    ================================================== -->
		<link rel="stylesheet" href="assets/css/style.css">
		<link rel="stylesheet" href="assets/css/night-mode.css">
		<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/uikit/3.2.1/css/uikit.min.css">

		<!-- icons
    ================================================== -->
		<link rel="stylesheet" href="assets/css/icons.css">

		<!-- Google font
    ================================================== -->
		<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">

	</head>

	<body>



		<!-- Content
    ================================================== -->
		<div uk-height-viewport class="uk-flex uk-flex-middle">
			<div class="uk-width-2-3@m uk-width-1-2@s m-auto rounded">
				<div class="uk-child-width-1-2@m uk-grid-collapse bg-gradient-primary" uk-grid>


					<!-- column one -->
					<div class="uk-margin-auto-vertical uk-text-center uk-animation-scale-up p-3 uk-light">
						<img src="assets/images/logo-light-icon.png" width="45" alt="">
					
						<p>祝您观影愉快. </p>
					</div>

					<!-- column two -->
					<div class="uk-card-default p-6">
						<div class="my-4 uk-text-center">
							<h2 class="mb-0"> 欢迎回来</h2>
							<p class="my-2">登录您的帐户</p>
						</div>
						<form>

							<div class="uk-form-group">
								<label class="uk-form-label"> 邮箱</label>

								<div class="uk-position-relative w-100">
									<span class="uk-form-icon">
										<i class="icon-feather-mail"></i>
									</span>
									<input class="uk-input" type="email" placeholder="name@example.com">
								</div>

							</div>

							<div class="uk-form-group">
								<label class="uk-form-label"> 密码</label>

								<div class="uk-position-relative w-100">
									<span class="uk-form-icon">
										<i class="icon-feather-lock"></i>
									</span>
									<input class="uk-input" type="password" placeholder="********">
								</div>

							</div>

							<div class="mt-4 uk-flex-middle uk-grid-small" uk-grid>
								<div class="uk-width-expand@s">
									<p> 没有帐户？ <a href="form-modern-singup.html">注册</a></p>
								</div>
								<div class="uk-width-auto@s">
									<button type="button" class="button primary" id="login">开始使用</button>
								</div>
							</div>

						</form>
					</div><!--  End column two -->

				</div>
			</div>
		</div>

		<!-- Content -End
    ================================================== -->


		<!-- For Night mode -->
		<script>
			(function(window, document, undefined) {
				'use strict';
				if (!('localStorage' in window)) return;
				var nightMode = localStorage.getItem('gmtNightMode');
				if (nightMode) {
					document.documentElement.className += ' night-mode';
				}
			})(window, document);


			(function(window, document, undefined) {

				'use strict';

				// Feature test
				if (!('localStorage' in window)) return;

				// Get our newly insert toggle
				var nightMode = document.querySelector('#night-mode');
				if (!nightMode) return;

				// When clicked, toggle night mode on or off
				nightMode.addEventListener('click', function(event) {
					event.preventDefault();
					document.documentElement.classList.toggle('night-mode');
					if (document.documentElement.classList.contains('night-mode')) {
						localStorage.setItem('gmtNightMode', true);
						return;
					}
					localStorage.removeItem('gmtNightMode');
				}, false);

			})(window, document);
		</script>


		<!-- javaScripts
    ================================================== -->
		<script src="https://cdn.bootcdn.net/ajax/libs/uikit/3.2.1/js/uikit.min.js"></script>
		<script src="assets/js/jquery-3.3.1.min.js"></script>
		<script src="assets/js/public.js"></script>
		<!--   <script src="assets/js/simplebar.js"></script>
    <script src="assets/js/main.js"></script> -->
		<script>
			$(function() {
				$("#login").click(function() {
					var userPassword = $("[type='password']").val();
					var email = $("[type='email']").val();
					if(userPassword===''&&email===''){
						UIkit.notification({
							message: '请输入账号密码',
							status: 'primary',
							pos: 'top-center',
							timeout: 1000
						});
					}else{
						$.ajax({
							url: apiurl + "tUser/login",
							type: "post",
							data: {
								'userPassword': $("[type='password']").val(),
								'email': $("[type='email']").val()
							},
							success: function(data) {
						
								if (data.code === 0) {
							
									
									UIkit.notification({
										message: data.msg,
										status: 'primary',
										pos: 'top-center',
										timeout: 1000
									});
									
									localStorage.setItem('userId', data.data.userId)
									localStorage.setItem('nickName', data.data.nickName)
									localStorage.setItem('avatar', data.data.avatar)
									localStorage.setItem('email', data.data.email)
									location.href = "home.html";
								} else {
						
						                UIkit.notification({
										message: data.msg,
										status: 'primary',
										pos: 'top-center',
										timeout: 1000
									});
						
								}
							}
						
						})
					}
			
				});
			});
		</script>

	</body>

</html>
